﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace YXShop.Web.admin.templates.label
{
    public partial class freedomlabel_test : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request["sql"] != null)
                {
                    string sql = System.Web.HttpUtility.UrlDecode(ChangeHope.WebPage.PageRequest.GetQueryString("sql"));
                    if (sql.Equals(""))
                    {
                        this.lblError.Text = "错误,SQL语句为空!";
                    }
                    else
                    {
                        try
                        {
                            DataTable tb = ChangeHope.DataBase.DataHelper.GetDataTableBySql(sql);                           
                            if (tb == null || tb.Rows.Count < 1)
                            {
                                this.lblError.Text = "记录为0";

                            }
                            else
                            {
                                this.GvData.DataSource = tb;
                                this.GvData.DataBind();
                                this.lblError.Visible = false;
                            }
                        }
                        catch (Exception eee)
                        {
                            this.lblError.Text = eee.Message;
                        }

                    }
                }
                else
                {

                }
            }  
        }
    }
}
